<?php
session_start();
require_once(ABSPATH . 'wp-admin/includes/user.php');
require_once(ABSPATH . WPINC . '/registration.php');
require_once dirname( __FILE__ ) . '/form-process.php'; 
?>
<?php get_header(); ?>
<!-- TextboxList is not priceless for commercial use. See <http://devthought.com/projects/mootools/textboxlist/> -->		
<!-- required stylesheet for TextboxList -->
<link rel="stylesheet" href="<?php echo bloginfo('url') . "/wp-content/themes/" . FOLDER_STR; ?>/js/TextboxList.css" type="text/css" media="screen" charset="utf-8" />
<!-- required stylesheet for TextboxList.Autocomplete -->
<link rel="stylesheet" href="<?php echo bloginfo('url') . "/wp-content/themes/" . FOLDER_STR; ?>/js/TextboxList.Autocomplete.css" type="text/css" media="screen" charset="utf-8" />

<script src="<?php echo bloginfo('url') . "/wp-content/themes/" . FOLDER_STR; ?>/js/mootools-1.2.1-core-yc.js" type="text/javascript" charset="utf-8"></script>		

<!-- required for TextboxList -->
<script src="<?php echo bloginfo('url') . "/wp-content/themes/" . FOLDER_STR; ?>/js/GrowingInput.js" type="text/javascript" charset="utf-8"></script>
        
<script src="<?php echo bloginfo('url') . "/wp-content/themes/" . FOLDER_STR; ?>/js/TextboxList.js" type="text/javascript" charset="utf-8"></script>		
<script src="<?php echo bloginfo('url') . "/wp-content/themes/" . FOLDER_STR; ?>/js/TextboxList.Autocomplete.js" type="text/javascript" charset="utf-8"></script>
<!-- required for TextboxList.Autocomplete if method set to 'binary' -->
<script src="<?php echo bloginfo('url') . "/wp-content/themes/" . FOLDER_STR; ?>/js/TextboxList.Autocomplete.Binary.js" type="text/javascript" charset="utf-8"></script>	

<script type="text/javascript" charset="utf-8">	
window.addEvent('load', function(){
	// Standard initialization		
	var t = new TextboxList('form_tags_input', {  });
	t.add('Football').add('Sport').add('Tag 3');  
	
	//var val = ',';
	//val =  set_tag();	
	//var val = $('#tTags').val();
	// With custom adding keys 
	var t2 = new TextboxList('form_tags_input_2', {bitsOptions:{editable:{addKeys: 188}}});	
	
		
	
	// With custom adding keys 
	var t2 = new TextboxList('form_tags_input_3', {bitsOptions:{editable:{addKeys: 188}}});
	t2.add('Sorel Mihai').add('Lee');

	
});
</script>
<!-- sample style -->
<style type="text/css" media="screen">
    .form_tags { margin-bottom: 10px; }
    
    /* Setting widget width example */
    .textboxlist { width: 400px; }
    
    /* Preloader for autocomplete */
    .textboxlist-loading { background: url('<?php echo bloginfo('url') . "/wp-content/themes/" . FOLDER_STR; ?>/images/spinner.gif') no-repeat 380px center; }
    
    /* Autocomplete results styling */
    .form_friends .textboxlist-autocomplete-result { overflow: hidden; zoom: 1; }
    .form_friends .textboxlist-autocomplete-result img { float: left; padding-right: 10px; }
    
    .note { color: #666; font-size: 90%; }
    #footer { margin: 50px; text-align: center; }
</style>

<div id="content">
	<div class="left">
    	<h2>Ask a question</h2>
        
        <div class="info">
        	<p>Try to be as detailed as possible in formuling your question and describing it. <br />Choosing tags carefully will also help you in getting the right answers as soon as posible.</p>
        </div>
        
        <div class="question-form">
        <form action="" method="post" id="new_post" name="new_post" enctype="multipart/form-data">
        <input type="hidden" name="action" value="post" />
        <?php wp_nonce_field('new-post'); ?>
                    <p>Your Question:</p>
                    <div class="text-publish">
                      <textarea name="question" cols='75' rows='3' value="<?=esc_html($_SESSION['question']); ?>" ></textarea>
                    </div>
                    <p>Describe your question:</p>
                    <div class="text-publish">
                      <textarea name="content" cols='75' rows='6' value="<?=esc_html($_SESSION['content']); ?>" ></textarea>
                    </div>
					<?php 
					//get all categories
                    $query = "SELECT  t.term_id,t.name
			 					FROM    wp_terms t JOIN wp_term_taxonomy tt ON t.term_id=tt.term_id
			 					WHERE tt.taxonomy = 'category' AND t.term_id >1  ";                  
                    $cate = $wpdb -> get_results($query);					
                    ?>
                    <p>Categories : </p><select id="cate" name="cate">
                    						<option value="0">Chose the Category...</option>
											<?php
                                            foreach ($cate as $c)
                                            {
                                            ?>
                                            	<option value="<?php echo $c->term_id; ?>"><?php echo $c->name; ?></option>
											<?php
                                            }
                                            ?>
                                        </select>       
                    
                
    <div style="display:none;" class="form_tags"><input type="text" name="test" value="" id="form_tags_input" /></div>
                
                <p>Tags: <font class="comma">Separated by comma</font></p>
                
                <div class="form_tags"><input type="text" name="tags" value="" id="form_tags_input_2" size="10" /> </div>
                <div class="height"></div>
                <p>Invite Users: <font class="comma">Separated by comma</font></p>
                <div class="form_tags"><input type="text" name="users" value="" id="form_tags_input_3" /></div>
                
                <div class="submit">
                    <div class="publish-submit">
                        <input type="image" onclick="submit()" src="<?php echo get_bloginfo('template_directory'); ?>/images/publish-submit.jpg" name="submitform" />
                    </div>
                    <div class="terms">
                        <p>By submiting this question you agree with our <a href="#">Terms of Service</a>.</p>
                    </div>
                </div>		
                
        </form>
        
        </div>
        
        
    </div> <!--//Left-->
    <?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>

